package chapter03

import org.apache.log4j.{Level, Logger}
import org.apache.spark.{SparkConf, SparkContext}

object Test23_groupByKey {
  def main(args: Array[String]): Unit = {
    Logger.getLogger("org.apache.spark").setLevel(Level.WARN)
    val conf = new SparkConf().setMaster("local[*]").setAppName("groupByKey")
    val sc = new SparkContext(conf)
    val value = sc.makeRDD(List(("a", 1), ("a", 1),
      ("b", 1), ("b", 1)))
    val value1 = value.groupByKey()
    println(value1.collect().toList)
  }
}
